// PcxImage.h: interface for the PcxImage class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_PCXIMAGE_H__EC77690E_8546_11D2_A42D_006097A44215__INCLUDED_)
#define AFX_PCXIMAGE_H__EC77690E_8546_11D2_A42D_006097A44215__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#ifndef _UNICODE

#include "Image.h"

typedef  short  (WINAPI *readpcxfile)(const char *filename,
									   short resolution,
									   short dither,
									   unsigned  int *hddb,
									   unsigned  int *hpal,
									   long v_object,
									   short (*pf)(short, long),
									   short  errormode);

class CLASS_DECL_D PcxImage : public Image  
{
DECLARE_DYNAMIC(PcxImage)
public:
	PcxImage();
	PcxImage(LPTSTR file);
	PcxImage(CString& file);
	virtual ~PcxImage();

	virtual void paint(CDC* pDC, AWTCanvas* canvas);
	virtual CSize getSize();
	virtual BOOL loadImage();
	virtual BOOL isValid()
		{return (m_hbmp != NULL);}

private:
	void construct(CString& file)
	{
		m_hbmp = NULL;
		m_hpal = NULL;
		m_hinstDll = ::LoadLibrary(_T("CRDEV3DE.DLL"));
    m_readpcxfile = (readpcxfile)::GetProcAddress(m_hinstDll, "readpcxfile");
		loadImage();
	}	

protected:
	HBITMAP m_hbmp;
	HPALETTE m_hpal;
	HINSTANCE m_hinstDll;
	readpcxfile	m_readpcxfile;
};

#endif

#endif // !defined(AFX_PCXIMAGE_H__EC77690E_8546_11D2_A42D_006097A44215__INCLUDED_)
